package com.badu.common.controller;

import org.springframework.stereotype.Controller;
import com.badu.common.exception.LoginException;
import com.badu.common.utils.ShiroUtils;
import com.badu.system.domain.UserDO;

@Controller
public class BaseController {
	public UserDO getUser() {
		ShiroUtils.getUser();
		UserDO userDO = new UserDO();
		userDO.setUsername("test");
		return userDO;
	}

	public Long getUserId() {
		try {
			return getUser().getUserId();
		} catch (Exception e) {
			throw new LoginException(e.getMessage());
		}
	}

	public String getUsername() {
		return getUser().getUsername();
	}
}